﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace YasharEl.Infrastructure.ProcessEngine.DomainModel.ProcessMetadata
{
    [ContractClass(typeof(ProcessMetadataCatalogContract))]
    public interface IProcessMetadataCatalog
    {
        IProcessDefinition GetProcessDefinition(long applicationId, long userId, long processDefinitionId);

        IList<IProcessDefinition> GetAvailableProcessDefinitions(long applicationId, long userId);
    }

    [ContractClassFor(typeof(IProcessMetadataCatalog))]
    internal abstract class ProcessMetadataCatalogContract : IProcessMetadataCatalog
    {
        #region IProcessMetadataCatalog Members

        public IProcessDefinition GetProcessDefinition(long applicationId, long userId, long processDefinitionId)
        {
            Contract.Requires<ArgumentNullException>(applicationId > 0, "applicationId should be valid positive number.");
            Contract.Requires<ArgumentNullException>(userId > 0, "userId should be valid positive number.");
            Contract.Requires<ArgumentNullException>(processDefinitionId > 0, "processDefinitionId should be valid positive number.");

            return default(IProcessDefinition);
        }

        public IList<IProcessDefinition> GetAvailableProcessDefinitions(long applicationId, long userId)
        {
            Contract.Requires<ArgumentNullException>(applicationId > 0, "applicationId should be valid positive number.");
            Contract.Requires<ArgumentNullException>(userId > 0, "userId should be valid positive number.");

            return new List<IProcessDefinition>();
        }

        #endregion
    }
}
